package com.tjsinfo.tjsoa.address.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.tjsinfo.tjsoa.address.inside.TAddresslistInside;
import com.tjsinfo.tjsoa.address.inside.TAddresslistInsideDao;
import com.tjsinfo.tjsoa.address.inside.TAddresslistInsideManager;

public class InsideDeleteAction extends Action {
	
    TAddresslistInsideManager addresslistInsideManager;
    TAddresslistInsideDao addresslistInsideDao;
    
	public TAddresslistInsideManager getAddresslistInsideManager() {
		return addresslistInsideManager;
	}

	public void setAddresslistInsideManager(
			TAddresslistInsideManager addresslistInsideManager) {
		this.addresslistInsideManager = addresslistInsideManager;
	}
	
	public TAddresslistInsideDao getAddresslistInsideDao() {
		return addresslistInsideDao;
	}

	public void setAddresslistInsideDao(TAddresslistInsideDao addresslistInsideDao) {
		this.addresslistInsideDao = addresslistInsideDao;
	}

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		try {
			String id=request.getParameter("id");
			TAddresslistInside ins=addresslistInsideManager.findById(Integer.valueOf(id));
			addresslistInsideDao.delete(ins);
			
			return mapping.findForward("success");
		}catch (Exception e) {
			e.printStackTrace();
			return mapping.findForward("failure");
		}
	}
}
